<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>编辑分类11</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>
  <div style="margin: 20px">
    <div class="basicInfo">
      <div class="record-formtitle">基本信息</div>
      <div class="layui-row form-row">
        <div class="layui-col-md6">
          <div class="layui-form-item">
              <div class="itemTr">站台名称:<span id="stationName"></span></div>
          </div>
          <div class="layui-form-item">
              <div class="itemTr">系统名称:<span id="systemValue"></span></div>
          </div>
          <div class="layui-form-item">
              <div class="itemTr">设备名称:<span id="productName"></span></div>
          </div>
        </div>
        <div class="layui-col-md6">
          <div class="layui-form-item">
              <div class="itemTr">专业:<span id="specialtyValue"></span></div>
          </div>
          <div class="layui-form-item">
              <div class="itemTr">类型:<span id="devTypeValue"></span></div>
          </div>
          <div class="layui-form-item">
              <div class="itemTr">维修方式:<span id="maintenanceFlag">计划维修</span></div>
          </div>
        </div>
      </div>
    </div>
    <div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role">
      <div class="record-formtitle">更新维修计划</div>
      <div class="layui-row form-row">
        <div class="layui-col-md6">
          <div class="layui-form-item">
            <label class="layui-form-label">维修日期:</label>
              <div class="layui-inline">
                  <input type="text" name="maintenanceDate" class="layui-input" id="maintenanceDate" placeholder="选择日期时间"  style="padding-right: 30px">
              </div>
          </div>
          <div class="layui-form-item">
              <div class="layui-inline">
                  <label class="layui-form-label">维修人:</label>
                  <div class="layui-input-block">
                      <input type="text" name="maintenancePerson" id="maintenancePersonName" class="layui-input" style="padding-right: 30px">
                  </div>
              </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-form-item">
              <div class="layui-inline">
                  <label class="layui-form-label">维修方式:</label>
                  <div class="layui-input-block">
                      <label class="layui-form-label" style="text-align: left">计划维修</label>
                  </div>
              </div>
            </div>
            <div class="layui-form-item">
              <div class="layui-inline">
                  <label class="layui-form-label">工单状态：</label>
                  <div class="layui-input-block">
                      <select name="taskStatus">
                          <option value="">请选择状态</option>
                          <option value="0">未处理</option>
                          <option value="1">处理中</option>
                          <option value="2">搁置</option>
                          <option value="3">已处理</option>
                      </select>
                  </div>
              </div>
            </div>
          </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">维修内容：</label>
        <div class="layui-input-block">
            <input type="text" name="maintenanceContent" class="layui-input" lay-verify="required">
        </div>
      </div>
      <div class="layui-form-item">
        <label class="layui-form-label">描述：</label>
        <div class="layui-input-block">
          <textarea type="text" name="remark" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
        </div>
      </div>
      <div class="dialog-footer">
        <button class="layui-btn layuiadmin-btn-admin" >取消</button>
        <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-equipment-plan-submit">确定</button>
      </div>
    </div>
    <div class="record-formtitle">维修记录</div>
    <table id="maintenanceRecord" lay-filter="maintenanceRecord"></table>   
  </div>
  <script src="../../layuiadmin/layui/layui.js"></script>  
  <script>
    function initData(data){
      layui.config({
        base: '../../layuiadmin/' //静态资源所在路径
      }).extend({
        index: 'lib/index' //主入口模块
        , my_send: '../myModules/my_send'
      }).use(['index', 'form','laydate','table','my_send'], function () {
        var $ = layui.$
          , form = layui.form
          ,laydate = layui.laydate
          ,table = layui.table
          , my_send = layui.my_send
          , http_proxy = layui.http_proxy;
          laydate.render({
            elem: '#maintenanceDate' //指定元素
            ,type: 'datetime'
          });
          $('#stationName').html(data.stationName);
          $('#systemValue').html(data.sysName);
          $('#productName').html(data.productName);
          $('#devType').html(data.devTypeValue);
          $('#devTypeValue').html(data.devTypeValue);
          $('#maintenanceDate').val(data.maintenanceDate)
          $('#maintenancePersonName').val(data.maintenancePersonName);
          $.ajax({
            url:http_proxy('/dev/maintenance/taskInfo?taskNo=')+data.taskNo,
            async: false,
            dataType:'json',
            type:'get',
            success:function(data){
              var data = data.data;
                form.val('layuiadmin-form-role',{
                  'maintenanceDate':data.maintenanceDate,
                  'maintenancePerson':data.maintenancePerson,
                  'maintenanceContent':data.maintenanceContent,
                  'remark':data.remark,
                  'taskStatus':data.taskStatus

                })
            }
          });
        //维修记录
        table.render({
          elem: '#maintenanceRecord'
          , url: http_proxy('/dev/maintenance/taskRecord?productId=')+data.productId //数据接口
          , page: true //开启分页
          , method: 'post'
          ,id:'maintenanceRecord'
          , response: {
            countName: '' //规定数据总数的字段名称，默认：count
            , dataName: 'data' //规定数据列表的字段名称，默认：data
            , roleName: ''
          }
          ,cols: [[
            {field: 'taskNo', title: '工单号'}
            ,{field: 'maintenanceDate', title: '维修日期'}
            ,{field: 'maintenanceFlag', title: '维修方式'}
            ,{field: 'maintenancePerson', title: '维修人',width: 100}
            ,{field: 'taskStatus', title: '工单状态'}
            ,{field: 'maintenanceContent', title: '维修内容',width: 100}
          ]]
        });
        form.on('submit(LAY-equipment-plan-submit)', function(data){
          debugger
              var field = data.field; //获取提交的字段
              var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
              //提交 Ajax 成功后，关闭当前弹层并重载表格
              //$.ajax({});
              parent.layui.table.reload('LAY-app-content-list'); //重载表格
              parent.layer.close(index); //再执行关闭 
            });
        })
    }
        
        

    
      
    </script>
</body>
</html>